<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Public_page_c extends CI_Controller {
        public function __construct() {
            parent::__construct();
            $this->load->model('public_page_m');
            $this->load->helper(array('html', 'url'));
        }
        
        public function index() {
            $data['title'] = 'SLU - SCIS Info Board';
            $data['public_post'] = $this->public_page_m->get_all_published_post();
            $data['body_id'] = 'home_body';
            
            if($this->session->userdata('logged_in')) {
              $this->load->view('authenticated/fragments/header_v', $data);
            } else {
              $this->load->view('header_v', $data);
            }
            $this->load->view('home_v', $data);
            $this->load->view('footer_v', $data);
        }
        
        function view_full_text($post_id){
            $data['full_text'] = $this->public_page_m->get_public_post($post_id);
            $data['title'] = 'SLU - SCIS Info Board';
            
            if($this->session->userdata('logged_in')) {
              $this->load->view('authenticated/fragments/header_v', $data);
            } else {
              $this->load->view('header_v', $data);
            }
            $this->load->view('view_page', $data);
            $this->load->view('footer_v', $data);
        }
        
        function about(){
            $data['title'] = 'Programs Page';
            $data['body_id'] = 'program_body';
            if($this->session->userdata('logged_in')) {
              $this->load->view('authenticated/fragments/header_v', $data);
            } else {
              $this->load->view('header_v', $data);
            }
            $this->load->view('about_v', $data);
            $this->load->view('footer_v', $data);
        }
        
        function program(){
            $data['title'] = 'Program';
            $data['body_id'] = 'program_body';
            if($this->session->userdata('logged_in')) {
              $this->load->view('authenticated/fragments/header_v', $data);
            } else {
              $this->load->view('header_v', $data);
            }
            $this->load->view('program_v', $data);
            $this->load->view('footer_v', $data);
        }
        
        function achievements(){
            $data['title'] = 'Achievements';
            if($this->session->userdata('logged_in')) {
              $this->load->view('authenticated/fragments/header_v', $data);
            } else {
              $this->load->view('header_v', $data);
            }
            $this->load->view('achievements_v', $data);
            $this->load->view('footer_v', $data);
        }
    }
?>
